package com.bwie.controller;

import com.bwie.param.TbRedEnvelopeParam;
import com.bwie.service.TbRedEnvelopeService;
import com.bwie.service.TbRedRecordService;
import com.bwie.utils.R;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * description:
 *
 * @Author youhongwei
 * @Create 2025/6/17 15:28
 * @Version 1.0
 */
@RestController
@RequestMapping("user/red")
public class RedController {

    @Autowired
    private TbRedEnvelopeService tbRedEnvelopeService;

    @Autowired
    private RedissonClient redissonClient;

    @Autowired
    private TbRedRecordService tbRedRecordService;

    @PostMapping("redList")
    public R redList(@RequestBody TbRedEnvelopeParam tbRedEnvelopeParam){
        return tbRedEnvelopeService.redList(tbRedEnvelopeParam);
    }

    @PostMapping("sendRed")
    public R sendRed(@RequestBody TbRedEnvelopeParam tbRedEnvelopeParam){
        return tbRedEnvelopeService.sendRed(tbRedEnvelopeParam);
    }

    @PostMapping("robRed")
    public R robRed(@RequestBody TbRedEnvelopeParam tbRedEnvelopeParam){
        return tbRedEnvelopeService.robRed(tbRedEnvelopeParam);
    }

    @PostMapping("onRecord/{recordId}")
    public R onRecord(@PathVariable("recordId") Integer recordId){
        return tbRedRecordService.onRecord(recordId);
    }


}
